import { defineStore } from 'pinia'
import { getRoutes$ } from '@api/login'
import { useUserStore } from './useUserStore'

export const useMenuStore = defineStore('menuStoreId', {
  state: () => {
    return {
      routes:[],
    }
  },
  getters: {},
  actions: {
    async getMenu(){
      const rolePerm = useUserStore().rolePerm
      const res = await getRoutes$(rolePerm)
      const { data } = res
      console.log('useMenuStore 中获取到的 routes:', data)
      this.routes = [...data]
      return data
    }
  }
})
